<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>输入密码</title>
</head>

<body>
    <script>
        var x = 123456, y, z;
        y = Number(prompt('请输入密码'));
        while (y != x) {
            y = Number(prompt("请输入正确密码"));
        }
        while(y==x){
            z=Number(prompt("请再次输入密码"));
            if(z==y)
            {
                alert('输入正确')
                break;
            }
            else
            alert('错误')
        }

      
    </script>
</body>

</html>